home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / ShareMailGiftware / AmigaTalk / user / PicComplexExample.st < prev    next >
Text File  |  2002-10-27  |  2KB  |  58 lines

  1. " ------------------------------------------------------------------ "
  2. " DisplayPic.st - Display a graphic file using the DataType classes. "
  3. " ------------------------------------------------------------------ "
  4.  
  5. Class DisplayPic :Object 
  6.   dtLibrary modeID objName intuition dtSystem logoPic dtAttrs
  7.   dtoTags   dto
  8. !
  9. [
  10.    new
  11.      dtLibrary <- Library new: 'datatypes.library'
  12.      dtLibrary openVersion: 44
  13.  
  14.      modeID    <- 0
  15.      objName   <- String new: 80
  16.  
  17.      intuition <- Intuition new
  18.      dtSystem  <- DataTypeSystem new
  19.  
  20.      logoPic   <- DataType new
  21.  
  22.      dtAttrs   <- Array new: 5
  23.      dtoTags   <- Array new: 7
  24.  
  25.      dtAttrs at: 1 put: (dtSystem getDTClassTag: #DTA_ObjName)
  26.      dtAttrs at: 2 put: (amigatalk getStringAddress: objName)
  27.      dtAttrs at: 3 put: (dtSystem getDTPictureTag: #PDTA_ModeID)
  28.      dtAttrs at: 4 put: (amigatalk getIntegerAddress: modeID)
  29.      dtAttrs at: 5 put: 0
  30.  
  31.      dtoTags at: 1 put: (intuition getGadgetAttr: #GA_Relverify)
  32.      dtoTags at: 2 put: 1
  33.      dtoTags at: 3 put: (intuition getGadgetAttr: #GA_Immediate)
  34.      dtoTags at: 4 put: 1
  35.      dtoTags at: 5 put: (dtSystem getDTClassTag: #DTA_DataType)
  36.      dtoTags at: 6 put: 0
  37.      dtoTags at: 7 put: 0
  38. |
  39.    cleanup
  40.      dto disposeDTObject.
  41.      dtLibrary close
  42. |
  43.    viewPic: filename
  44.      self new. 
  45.  
  46.      dto <- logoPic newDTObject: filename tags: dtoTags.
  47.  
  48.      (dto == nil)
  49.         ifTrue: [ logoPic translateDTErrorNum print.
  50.                   ^ nil  
  51.                 ].
  52.  
  53.      dto getDTAttrs: dtAttrs
  54.      ...
  55.      self cleanup
  56. ]
  57.